
#include "S_20_PowerConsumption_doGet.h"
#include "mi_iid_define.h"
#include "property_decoder.h"
#include "section_define.h"
#include "main.h"

extern uint8_t  g_uNo1RegList[PBS_NO1REGSIZE];

/**
 * 格式: property_value_new_float(浮点数)　
 * 取值: 最小值: 0.0, 最大值: 1.0E7, 步长: 0.01
 */
static void P_20_1_PowerConsumption_doGet(property_operation_t *o)
{
	uint32_t Data = 0;
	float Temp = 0.0;
#if 	PROPERTY_TYPE
//	if((g_uNo1RegList[0x24]>>7) & 0x01)	
	{
		Data = ((g_uNo1RegList[0x24]<<24)|(g_uNo1RegList[0x23]<<16) | (g_uNo1RegList[0x22]<<8) | g_uNo1RegList[0x21]) & 0x7FFFFFFF;
		Temp = (float)Data /100.0;
		property_value_new_double(&o->value,Temp);	
	}

#else	
    o->value.format = PROPERTY_FORMAT_NUMBER;
	o->value.data.number.type = DATA_NUMBER_FLOAT;
	o->value.data.number.value.floatValue = 0.05; // TODO: 这里需要读到属性真正的值
#endif
}

void S_20_PowerConsumption_doGet(property_operation_t *o)
{
    switch (o->piid)
    {
        case PIID_20_1_PowerConsumption:
            P_20_1_PowerConsumption_doGet(o);
            break;

        default:
            o->code = OPERATION_ERROR_VALUE;
            break;
    }
}
